<template>
  <div class="box" style="width: 100vw;height: 100vh">
    <map-box  :cityCode="cityCode" :cityName="cityName" @handleClickRegion="handleClickRegion"
              @loadingSuccess="loadingSuccess" @changeTitle="changeTitle"></map-box>
  </div>
</template>

<script>
import mapBox from "../../components/Map2/Map2.vue";
export default {
  components:{
    mapBox
  },
  name: "Map",
  data(){
    return {
      cityCode:null,
      cityName:null,
    }
  },
  created() {
    this.cityCode = this.$route.query.cityCode
    this.cityName = this.$route.query.cityName
  },
  methods:{
    setTime() {
      let dt = new Date();
      let time = dt.getFullYear() + "年" +
          dt.getMonth() + 1 + "月" +
          dt.getDate() + "日-" +
          dt.getHours() + "时" +
          dt.getMinutes() + "分" +
          dt.getSeconds() + "秒";
      this.currentTime = time
    },
    //点击区域
    handleClickRegion(e) {
      let code = e.adcode
      if (code == 500000) {
        this.showItems.show1 = true
        this.showItems.show2 = true
      } else {
        this.showItems.show1 = false
        this.showItems.show2 = false
      }
    },
    //地图加载完成
    loadingSuccess() {
      this.loading = false
    },

    changeTitle(name) {
      this.title_name = name
    }
  }
}
</script>

<style scoped>

</style>
